<?php
header('Content-type: text/html; charset=utf-8');
include('c_i18n_property.php');

$oI18n = Container::createI18n('de', 'property');

$oI18n->load('labels');
$oI18n->loadAll('user');

//echo $oI18n->get('welcome', array('%1' => 'Igor'));
//echo $oI18n->get('label');
//print_r($oI18n->getDictionary());

//----------

class Container
{
	public static $oI18n = NULL;

	public static function createI18n($language, $type)
	{
		self::$oI18n = NULL;

		switch ($type)
		{
			case 'property':
			{
				self::$oI18n = new cI18nProperty();
				self::$oI18n->init();
			}
			break;

			case 'xml':
			{
				//...
			}
			break;

			case 'db':
			{
				//...
			}
			break;

			default:
			{
				throw new RuntimeException('Wrong i18n type!!!');
			}
			break;
		}

		self::$oI18n->setLanguage($language);

		return self::$oI18n;
	}

	public static function getI18n()
	{
		return self::$oI18n;
	}
}
